<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition   xmlns="http://www.w3.org/1999/xhtml"
			      xmlns:h="http://java.sun.com/jsf/html"
				  xmlns:p="http://primefaces.org/ui"
			      xmlns:f="http://java.sun.com/jsf/core"
			      xmlns:ui="http://java.sun.com/jsf/facelets"
			      >

	<p:panel header="Search Options" toggleable="true"
		toggleOrientation="vertical" collapsed="false">
		<p:panelGrid columns="2" style="margin-bottom:10px;font-size:14px;" cellpadding="5">
			<f:facet name="header">

			</f:facet>

			<h:outputText value="Country: " />
			<p:selectOneMenu style="width:180px" id="countriesMapping"
				value="#{mappingManagedBean.country}" required="true" requiredMessage="Required">
				<f:selectItem itemLabel="--Select Country--" itemValue="" />
				<f:selectItems value="#{servicesManagedBean.allCountriesList}" />
				<p:ajax update="CMDistributors" listener="#{mappingManagedBean.updateDistributorsList}"/>
			</p:selectOneMenu>
			
			<h:outputText value="Distributor: " />
    	 <p:selectOneMenu style="width:120px" id="CMDistributors" value="#{mappingManagedBean.distributor}" required="true" requiredMessage="Required">    
            <f:selectItems value="#{mappingManagedBean.distList}" />
            </p:selectOneMenu>
			<p:commandButton value="GO" update="mappingtableP @form"
					action="#{mappingManagedBean.updateList}" />

			
				<h:commandLink rendered="#{mappingManagedBean.methodCalled}">
					<p:graphicImage value="NWDSAKMS-excel-logo.png" width="30"
						height="30" title="Export to Excel" style="border:0" />
					<p:dataExporter type="xls" target="mappingtable"
						fileName="Country_Mapping_#{servicesManagedBean.dateNow}" />
				</h:commandLink>



		</p:panelGrid>

	</p:panel>



<p:panel id="mappingtableP">
	<p:dataTable id="mappingtable" style="margin-top:5px" rendered="#{mappingManagedBean.methodCalled}" var="map" value="#{mappingManagedBean.mlist}"
			 paginator="true" 
             rows="20"   
             paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
             rowsPerPageTemplate="20,40,60,80" 
             lazy="true"
             >
              
  
        <f:facet name="header" >  
  <p:outputPanel style="float: left">       
    <h:outputText value="Chub country mapping " />
  </p:outputPanel>           
        </f:facet>
        
 	
 	        <p:column>
		        <f:facet name="header" >  
	    			COUNTRY
		        </f:facet>  
		             <h:outputText value="#{map.cmmCountryCode} " /> 
        </p:column>  
        
          
        <p:column>
	        <f:facet name="header" >  
	                    DIST_CODE
	            </f:facet>  
	             
	             <h:outputText value="#{map.cmmDistCode}" /> 
        </p:column>  
        
              <p:column>
        <f:facet name="header" >  
                    DIST_MATERIAL_CODE
            </f:facet>  
             
             <h:outputText value="#{map.cmmDistMaterialCode}" /> 
        </p:column> 
        
  
        <p:column>  
            <f:facet name="header" >  
                    SAP_MATERIAL_CODE 
            </f:facet>  
            
            <h:outputText value="#{map.cmdSapMaterialCode}" /> 
        </p:column>  
  
             <p:column>
        <f:facet name="header" >  
                    DIST_MATERIAL_DESC
            </f:facet>  
             
             <h:outputText value="#{map.cmmDistMaterialDesc}" /> 
        </p:column> 
        
        
        <p:column>
        <f:facet name="header" >  
                    UOM
            </f:facet>  
           
             <h:outputText value="#{map.cmmUom}" /> 
        </p:column> 
        
        
         <p:column>
        <f:facet name="header" >  
                    CS_PC
            </f:facet>  
             
             <h:outputText value="#{map.cmmCsPc}" /> 
        </p:column>  
  
  
     <p:column>
            <f:facet name="header" >  
               SEC_CODE
            </f:facet>
            
            <h:outputText value="#{map.cmmSecCode}" /> 
       </p:column>
        
       <p:column>
	        <f:facet name="header" >  
	                    TYPE
	            </f:facet>  
	             <h:outputText value="#{map.cmmType}" /> 
       </p:column> 
    
    
    
          <p:column>  
            <f:facet name="header" >  
                    PIECES
            </f:facet>  
            
            <h:outputText value="#{map.cmdPieces}" />  
        </p:column>  
        
        
        <p:column> 
        <f:facet name="header" >  
                    TTS_PERCENT
            </f:facet>  
             
             <h:outputText value="#{map.cmdTtsPercent}" /> 
        </p:column>  
 	
     <p:column>
        <f:facet name="header" >  
                    COUNT_FLAG
            </f:facet>  
             <h:outputText value="#{map.countFlag}" /> 
        </p:column>
        
        <p:column>
        <f:facet name="header" >  
                    DIVISION_NO
            </f:facet>  
             <h:outputText value="#{map.divisionNo}" /> 
        </p:column>
        
       <p:column>
        <f:facet name="header" >  
                    PROMOTION_TYPE
            </f:facet>  
             <h:outputText value="#{map.promotionType}" />             
        </p:column>
     
   
    </p:dataTable>
</p:panel>

</ui:composition>